{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用eclat函数挖掘频繁项集"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWEAAADQCAYAAADWHtCzAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAWr0lEQVR4nO3dfbRddX3n8ffHCJIooEh0CBAupqBTn6BmYWeCtoCltqVSukpLtFiNFVZHRUgHRxy7hFntsg8uOkAYaqwBoRaW1aAgU+QpWFpt8SZgkaLlobFiaJUCBRuUIXzmj70v2Tk5D/vee87dZ9/7ea11Fvfsp/s9S/PNL7/z258t20RERDOe03QBERELWZpwRESD0oQjIhqUJhwR0aA04YiIBqUJR0Q06LlNFzBO9t9/f09MTDRdRkTMM5s3b37Y9tJu+9KEKyYmJpicnGy6jIiYZyR9u9e+TEdERDQoI+GKbdu2cd555zVdRkSMsY985CNDvV7rRsKSFkv6sqRF5fuzJP1Q0r49jl8q6fq5rTIiop7WNWFgDbDR9o7y/Wrga8BJ3Q62/X3gIUmr5qi+iIja2tiE3wZ8AUDSCuAFwIcpmnEvny/Pi4gYK61qwpL2BF5me2u5aTVwJXAb8HJJL+lx6iTwhh7XPE3SpKTJ7du3D7vkiIi+WtWEgf2BxyrvTwGusv0MsBE4ucd53wOWddthe73tlbZXLlmyZKjFRkQM0rbVEU8CewFIeg1wGHCjJIA9gQeAi7uct1d5bkTEWGnVSNj2o8AiSXtRTEWca3uifC0DDpR0iKQDJd1cOfVw4BtN1BwR0U/bRsIANwBHU0xF/FzHvqvL7TcDT1e2HwNcN+jCy5YtG/oawIiIftrYhNcBa20f2rnD9loASe9l12mJtwAnzk15ERH1ta4J275D0iZJiyprhTuPWT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0pKm64jxlCVqESM2iuStmD8yEo4AJL1d0t+Xub5XSDpE0s3ltpslLS+Pu0zSr1TO+0H535+WdKukz0r6pqRPq3AGsIzihoxNzXy6GGd55H0seJJeCfxPinCWhyXtB3yKIov5U5LWABcCvzTgUkcCr6TIHfmb8noXlrm6x2QkHN1kJBwBxwKfnWqSth8B/gvw5+X+K4Cja1zndtsP2n4GuBOYGEGtMc+kCUcUUaaDvhyZ2v805Z+bMlBoz8oxP6r8vIP8SzNqSBOOgJuBX5X0YoByOuIrFAlgAG+jeOwQwFbgdeXPJ1I8CWOQJ4C9h1VszC/5mzoWPNt3S/o94MuSdgB3AGcAGySdDXwfeGd5+CeAL0i6naJ5/0eNX7Ee+EtJD9k+ZvifINosS9QiIhqU6YiIiAalCUdENChNOCKiQWnCERENShOOiGhQmnBERIPShCMiGpQmHBHRoP8PZ0akADOg/dUAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 360x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "from fim import eclat\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "#根据示例数据，手动输入构建包含事务信息的list对象\n",
    "transactions=[['A', 'D'], ['A', 'E', 'F'], ['A', 'B', 'C', 'E', 'F'],\n",
    "              ['B', 'C', 'D'], ['A', 'C', 'D', 'E', 'F'], ['A', 'B', 'D', 'F']]\n",
    "rules = eclat(tracts=transactions, zmin=1, supp=50)\n",
    "plt.figure(figsize=(5, 3))\n",
    "tmp = pd.DataFrame(rules).sort_values(1, ascending=True)\n",
    "tmp = tmp.set_index(tmp[0])\n",
    "tmp[1].plot(kind='barh', color='gray')\n",
    "plt.ylabel(\"freq itemsets\")\n",
    "plt.xlabel(\"count\")\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
